home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / cross / ava-0.2.5.lha / ava-0.2.5 / examples / helloled.s < prev    next >
Encoding:
Text File  |  1999-03-23  |  977 b   |  44 lines

  1. /* helloled.s 
  2.  
  3.    Example from the Chapter 5.1.2
  4.    
  5.    Uros Platise (c) 1999 
  6. */
  7.  
  8. /* set target device; see arch.inc for other models. */
  9. #arch AT90S1200
  10.  
  11. /* Load include file of predefined port definitions.
  12.    This file should not be included unitl device is selected. 
  13.    See inside of the avr.inc for details.
  14. */
  15. #include "avr.inc"
  16.  
  17. /* general declarations */
  18. #define LED1        PB0
  19.     
  20. /* calculate port B direction */
  21. #define PORTB_DIR   BV(LED1)
  22.  
  23. /* register naming */
  24. #define Tmp            r16
  25.  
  26. /* AVR AT90S1200 vectors start at address 0 */
  27.     seg abs=0 flash.code
  28.         
  29.         rjmp __reset_   /* this vector is executed on every reset */
  30.         reti
  31.         reti
  32.         reti
  33.     
  34. /* Initialize hardware ports */    
  35. __reset_:
  36.         ldi Tmp, PORTB_DIR  /* set port B direction */
  37.         out DDRB, Tmp
  38.         
  39.         clr Tmp             /* clear outputs and disable pull-ups */
  40.         out PORTB, Tmp
  41.         
  42. loop:   rjmp loop           /* loop for ever */
  43.  
  44.